package cc.rengu.igas.bomp.common.enums;

import cc.rengu.oltp.utility.util.StringUtil;

/**
 * Created by zhangxuran on 2020/03/26
 */
public enum ArtifCertTypeEbnum {
    ID_CARD_CERT("01", "身份证"),
    OFFICER_CERT("02", "军官证"),
    PASSPORT_CERT("03", "护照"),
    ACCOUNT_CERT("04", "户口簿"),
    SOLDIER_CERT("05", "士兵证"),
    HK_MA_PERMIT("06", "港澳来往内地通行证"),
    TAIWAN_PERMIT("07", "台湾同胞来往内地通行证"),
    TEMP_ID_CARD_CERT("08", "临时身份证"),
    FOREIGNER_RESIDENCE_CERT("09", "外国人居留证"),
    POLICE_CARD_CERT("10", "警官证"),
    OTHER_CERT("99", "其它"),
    ;

    private String cardCode;
    private String cardDesc;

    ArtifCertTypeEbnum(String cardCode, String cardDesc) {
        this.cardCode = cardCode;
        this.cardDesc = cardDesc;
    }

    public String getCardCode() {
        return cardCode;
    }

    public String getCardDesc() {
        return cardDesc;
    }

    /**
     * 根据证件类型编码查询证件类型描述
     *
     * @param cardCode 证件类型编码
     * @return cardDesc
     */
    public static String getDescByCode(String cardCode) {
        for (ArtifCertTypeEbnum artifCertTypeEbnum : ArtifCertTypeEbnum.values()) {
            if (artifCertTypeEbnum.getCardCode().equals(cardCode)) {
                return artifCertTypeEbnum.getCardDesc();
            }
        }
        return null;
    }

    /**
     * 是否微信实名认证所需证件类型
     *
     * @param cardCode 证件类型
     */
    public static boolean isWechatRealNameArtifCertType(String cardCode) {
        if (StringUtil.isEmptyOrNull(cardCode)) {
            return false;
        }
        return ID_CARD_CERT.getCardCode().equals(cardCode)
                || PASSPORT_CERT.getCardCode().equals(cardCode)
                || HK_MA_PERMIT.getCardCode().equals(cardCode)
                || TAIWAN_PERMIT.getCardCode().equals(cardCode);
    }
}
